import requests from '../config/request.js'

//--------------------------------------------客户端接口--------------------------------------------------------

//查询教练所有tag
export const getAllTagList = (payload) => {
	return requests.httpRequest({
		url: "App/GetAllTagList",
		data: payload
	});
};

//获取所有的城市
export const getCityAddressList = (payload) => {
	return requests.httpRequest({
		url: "App/GetCityAddressList",
		data: payload
	});
};

//优惠券已使用  未使用
export const getCustomerStoreCouponStatus = (payload) => {
	return requests.httpRequest({
		url: "Customer/GetCustomerStoreCouponStatus",
		data: payload
	});
};
//获取教练列表
export const servePlayerList = (payload) => {
	return requests.httpRequest({
		url: "Serve/GetWebServePlayerInfoList",
		data: payload
	});
};

//获取教练详情
export const servePlayerDetailInfo = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetServePlayerDetailInfo",
		data: payload
	});
};


// //教练详情页面，贡献榜前三名
// export const servePlayerDetailGiftRank = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/GetWebServePlayerDetailGiftRank",
// 		data: payload
// 	});
// };

//教练详情页面，照片列表
// export const getWebServePlayerPhotoList = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/GetWebServePlayerPhotoList",
// 		data: payload
// 	});
// };

//教练详情页面，视频列表
export const getWebServePlayerVideoList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetWebServePlayerVideoList",
		data: payload
	});
};

//教练详情页面，评论总数量
export const getAppServePlayerCommentQty = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetAppServePlayerCommentQty",
		data: payload
	});
};

//教练详情页面，最新评论
// export const getWebServePlayerDetailComment = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/GetWebServePlayerDetailComment",
// 		data: payload
// 	});
// };

//评论列表
export const getAppServePlayerCommentList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetAppServePlayerCommentList",
		data: payload
	});
};

//教练详情页面，获取评论总星级
export const getAppCommentScore = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetAppCommentScore",
		data: payload
	});
};


//教练详情页面，获取礼物列表
export const getWebGiftList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetWebGiftList",
		data: payload
	});
};

//教练详情页面，积分送礼物
export const givingGiftsBalance = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GivingGiftsBalance",
		data: payload
	});
};

//教练详情页面，送礼物
export const givingGifts = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GivingGifts",
		data: payload
	});
};

//教练详情页面，点赞
export const updateServePlayerLikeCount = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/UpdateServePlayerLikeCount",
		data: payload
	});
};

//教练详情页面，取消点赞
// export const cancelServePlayerLikeCount = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/CancelServePlayerLikeCount",
// 		data: payload
// 	});
// };


//教练详情页面，关注教练
// export const servePlayerAttention = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/ServePlayerAttention",
// 		data: payload
// 	});
// };

//教练详情页面，取消关注
// export const cancelPlayerAttention = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Serve/CancelAttention",
// 		data: payload
// 	});
// };


//对教练下单  获取教练近3天的日程
export const getWebServePlayerDateList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetWebServePlayerDateList",
		data: payload
	});
};


//获取教练照片列表
export const getServePlayerPhotoInfoList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetServePlayerPhotoInfoList",
		data: payload
	});
};

//获取教练视频列表
export const getServePlayerVideoInfoList = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetServePlayerVideoInfoList",
		data: payload
	});
};

//获取教练榜单前10名
export const getAppServePlayerBangDan = (payload) => {
	return requests.httpRequest({
		url: "App/GetAppServePlayerBangDan",
		data: payload
	});
};

//获取所有门店
export const getStoreAllList = (payload) => {
	return requests.httpRequest({
		url: "App/GetStoreAllList",
		data: payload
	});
};

//获取自提点门店
export const getPostageStoreList = (payload) => {
	return requests.httpRequest({
		url: "App/GetPostageStoreList",
		data: payload
	});
};

//提交订单
export const submitOrder = (payload) => {
	return requests.httpTokenRequestSpecial({
		url: "Serve/SubmitOrder",
		data: payload
	});
};

//获取我的陪玩订单列表
export const getAppMyPlayOrderInfoList = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetAppMyPlayOrderInfoList",
		data: payload
	});
};

//获取订单详情
export const getAppPlayOrderDetail = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetAppPlayOrderDetail",
		data: payload
	});
};

//更新订单状态
export const updatePlayerOrderStatus = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/UpdatePlayerOrderStatus",
		data: payload
	});
};

//评价订单
export const playerOrderComment = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/PlayerOrderComment",
		data: payload
	});
};

//申请退款
export const playerOrderRefund = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/PlayerOrderRefund",
		data: payload
	});
};

//更新订单状态
export const updatePlayerOrderStatusTemp = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/UpdatePlayerOrderStatusTemp",
		data: payload
	});
};


//更新个人头像
export const saveCustomerHeadimg = (payload) => {
	return requests.httpTokenRequest({
		url: "Home/SaveCustomerHeadimg",
		data: payload
	});
};

//更新个人信息
export const saveCustomerInfobykey = (payload) => {
	return requests.httpTokenRequest({
		url: "Home/SaveCustomerInfobykey",
		data: payload
	});
};

//获取个人信息
export const getCustomerInfo = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetCustomerInfo",
		data: payload
	});
};

//同步客户原信息
export const tongbuCustomerInfo = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/TongBuCustomerInfo",
		data: payload
	});
};

//发送验证码
export const sendValidateCode = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/SendValidateCode",
		data: payload
	});
};

//校验验证码是否正确
export const checkValidateCode = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/CheckValidateCode",
		data: payload
	});
};

//设置密码
export const setAccountPassword = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/SetAccountPassword",
		data: payload
	});
};


//修改密码
export const changeAccountPassword = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/ChangeAccountPassword",
		data: payload
	});
};


//地址列表
export const getAppAddressList = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetAppAddressList",
		data: payload
	});
};

//地址详情
// export const getAppAddressInfo = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/GetAppAddressInfo",
// 		data: payload
// 	});
// };

// //保存地址
// export const saveAppAddress = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/UpdateAppAddress",
// 		data: payload
// 	});
// };

// //删除地址
// export const deleteAppAddress = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/DeleteAppAddress",
// 		data: payload
// 	});
// };

// //设置默认地址
// export const setDefaultAddress = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/SetDefaultAddress",
// 		data: payload
// 	});
// };


// //获取关注列表
// export const getAppMyAttentionList = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/GetAppMyAttentionList",
// 		data: payload
// 	});
// };

export const cancelAttention = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/CancelAttention",
		data: payload
	});
};

//获取我的消费记录
export const getMyConsumptionList = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetAppMyConsumptionList",
		data: payload
	});
};

//获取我的退款
// export const getAppPlayOrderRefundList = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/GetAppPlayOrderRefundList",
// 		data: payload
// 	});
// };

//获取客房我的退款
// export const searchAppGuestRoomOrderRefundList = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/SearchAppGuestRoomOrderRefundList",
// 		data: payload
// 	});
// };

//我的兑换码
export const getAppExchangeCertificateList = (payload) => {
	return requests.httpTokenRequest({
		url: "Recharge/GetCustomerExchangeCertificateList",
		data: payload
	});
};

//充值金额列表
export const getRechargeAmountList = (payload) => {
	return requests.httpTokenRequest({
		url: "Recharge/GetRechargeAmountList",
		data: payload
	});
};

// //我的充值订单
// export const getMyRechargeOrderList = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Recharge/GetMyRechargeOrderList",
// 		data: payload
// 	});
// };


//获取客户余额
export const getCustomerCashBalance = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetCustomerCashBalance",
		data: payload
	});
};

//提交充值订单
export const submitRechargeOrder = (payload) => {
	return requests.httpTokenRequestSpecial({
		url: "Recharge/SubmitRechargeOrder",
		data: payload
	});
};

//取消充值订单
export const cancelRechargeOrder = (payload) => {
	return requests.httpTokenRequest({
		url: "Recharge/CancelRechargeOrder",
		data: payload
	});
};

//获取奖项
export const getWechatPrizeList = (payload) => {
	return requests.httpTokenRequest({
		url: "Recharge/GetWechatPrizeList",
		data: payload
	});
};

//抽奖
export const customerRaffle = (payload) => {
	return requests.httpTokenRequest({
		url: "Recharge/CustomerRaffle",
		data: payload
	});
};

//获取陪玩优惠券
export const getServePlayCustomerCoupons = (payload) => {
	return requests.httpTokenRequest({
		url: "Serve/GetServePlayCustomerNewCoupons",
		data: payload
	});
};

//获取用户所有的优惠券
// export const getCustomerAllNewCouponsById = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/GetCustomerAllNewCouponsById",
// 		data: payload
// 	});
// };

//根据优惠券Id获取优惠券详情
// export const getCustomerStoreCouponNewInfoById = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/GetCustomerStoreCouponNewInfoById",
// 		data: payload
// 	});
// };


// //门店核销优惠券
// export const storeVerificationCoupon = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/StoreVerificationCoupon",
// 		data: payload
// 	});
// };


//获取当权登录人员门店信息
export const getCustomerOnStore = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetCustomerOnStore",
		data: payload
	});
};

//获取当前人员所在门店核销的优惠券
export const searchWechatStoreVerificationCoupon = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/SearchWechatStoreVerificationCoupon",
		data: payload
	});
};

//获取核销类型
export const getConcponTypeList = (payload) => {
	return requests.httpTokenRequest({
		url: "/APP/GetConcponTypeList",
		data: payload
	});
};

//获取核销方式
export const getCustomerCouponUsingWay = (payload) => {
	return requests.httpTokenRequest({
		url: "/APP/GetCustomerCouponUsingWay",
		data: payload
	});
};


//根据客户编号，获取客户信息。
export const getCustomerInfoByUserNumber = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetCustomerInfoByUserNumber",
		data: payload
	});
};

// 分页获取系统中可使用的优惠券
// export const searchStoreCouponNew = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "StoreCouponNew/SearchStoreCouponNew",
// 		data: payload
// 	});
// };

// // 发放优惠券
// export const wechatProvideCoupon = (payload) => {
// 	return requests.httpTokenRequest({
// 		url: "Customer/WechatProvideCoupon",
// 		data: payload
// 	});
// };


// 优惠券参数详细
export const getStoreCouponNewInfoById = (payload) => {
	return requests.httpTokenRequest({
		url: "Customer/GetStoreCouponNewInfoById",
		data: payload
	});
};

//获取优惠券配置参数
export const getCouponSetting = (payload) => {
	return requests.httpRequest({
		url: "Customer/GetOrderCouponSettingByOrderType",
		data: payload
	});
};
// **************************************************************************新接口****************
export const getPlayerInfo = (payload) => {
	console.log(payload,'playerId')
    return requests.requestAll("/client/serverPlayer/getPlayerInfo?playerId="+payload);
};


export const getUserByToken = () => {
	let token=uni.getStorageSync('userToken')
    return requests.requestAll("/client/wx/login/getUserByToken?token="+token);
};
// 收货地址列表
export const addressList = (params) => {
    return requests.requestAll("/client/customerAddress/list",'post',params,false);
};

//地址详情
export const getAppAddressInfo = (payload) => {
	 return requests.requestAll("/client/customerAddress/info",'post',payload,false);
};

//保存地址
export const saveAppAddress = (payload) => {
	 return requests.requestAll("/client/customerAddress/add",'post',payload,false);
};
// 编辑
export const editAppAddress = (payload) => {
	 return requests.requestAll("/client/customerAddress/edit",'post',payload,false);
};

//删除地址
export const deleteAppAddress = (payload) => {
	return requests.requestAll("/client/customerAddress/remove",'post',payload,false);
};

//设置默认地址
export const setDefaultAddress = (payload) => {
	return requests.requestAll("/client/customerAddress/default",'post',payload,false);
};

// 约玩退款
export const getAppPlayOrderRefundList = (payload) => {
	return requests.requestAll("/client/serverPlayer/playOrderRefundList",'post',payload,false);
};

// 获取关注列表
export const getAppMyAttentionList = (payload) => {
	return requests.requestAll("/client/serverPlayer/listMyFocus",'post',payload,false);
};
// 余额充值订单
export const getMyRechargeOrderList = (payload) => {
	return requests.requestAll("/client/customerBalance/customerBalanceHisOrderList",'post',payload,false);
};

//教练详情页面，贡献榜前三名
export const servePlayerDetailGiftRank = (payload) => {
	return requests.requestAll("/client/serverPlayer/contributeRanking",'get',payload);
};
//教练详情页面，照片列表
export const getWebServePlayerPhotoList = (payload) => {
	return requests.requestAll("/client/serverPlayer/queryPlayerMedia",'get',payload);
};
//教练详情页面，评论
export const getWebServePlayerDetailComment = (payload) => {
	return requests.requestAll("/client/serverPlayer/allComment",'get',payload);
};
// 我的客房退款记录
export const searchAppGuestRoomOrderRefundList = (payload) => {
	return requests.requestAll("/client/room/roomOrderRefundList",'post',payload,false);
};
// 我的消费记录
export const consumerRecordList = (payload) => {
	return requests.requestAll("/client/vipLevel/consumerRecordList",'post',payload,false);
};
// 我的优惠券
export const getCustomerAllNewCouponsById = (payload) => {
	return requests.requestAll("/client/storeCoupon/myCoupon",'post',payload,false);
};
// 分页获取系统中可使用的优惠券
export const searchStoreCouponNew = (payload) => {
	return requests.requestAll("/client/storeCoupon/getAvailableCoupon",'post',payload,false);
};

// 发放优惠券
export const wechatProvideCoupon = (payload) => {
	return requests.requestAll("/client/storeCoupon/sendCoupon",'post',payload,false);
};


// 发放优惠劵高
export const wechatProvideCouponGao = (payload) => {
	return requests.requestAll("/client/storeCoupon/add",'post',payload,false);
};

//根据优惠券Id获取优惠券详情
export const getCustomerStoreCouponNewInfoById = (id) => {
	return requests.requestAll("/client/storeCoupon/getCouponDetails?id="+id,'post');
};

//门店核销优惠券
export const storeVerificationCoupon = (payload) => {
	return requests.requestAll("/client/storeCoupon/writeOffCoupon",'post',payload,false);
}

// 获取朋友消息字典
export const allTag = (payload) => {
	return requests.requestAll("/client/serverPlayer/allTag",'post',payload,false);
}


// 当天是否已签到
export const isSignIn = (payload) => {
	return requests.requestAll("/client/makeFriends/isSignIn",'post',payload,false);
}

export const signIn = (payload) => {
	return requests.requestAll("/client/makeFriends/signIn",'post',payload,false);
}


//教练详情页面，取消点赞
export const cancelServePlayerLikeCount = (payload) => {
		return requests.requestAll("/client/serverPlayer/addLikeCount",'get',payload);
};
//教练详情页面，添加关注
export const servePlayerAttention = (payload) => {
	return requests.requestAll("/client/serverPlayer/addFocus",'post',payload,false);
	
};

//教练详情页面，取消关注
export const cancelPlayerAttention = (payload) => {
	
	return requests.requestAll("/client/serverPlayer/cancelFocus",'get',payload);
	// return requests.httpTokenRequest({
	// 	url: "Serve/CancelAttention",
	// 	data: payload
	// });
};
// 用户查询存单
export const playerOrderDetailsList = (payload) => {
	return requests.requestAll("/client/customer/playerOrderDetailsList",'post',payload,false);
	// return requests.httpTokenRequest({
	// 	url: "Serve/CancelAttention",
	// 	data: payload
	// });
};
// 用户核销订单
export const confirmPlayerOrderDetails = (payload) => {
	return requests.requestAll("/client/customer/confirmPlayerOrderDetails",'post',payload,false);
};

// /**
//  * 关注教练
//  * @param data {focePlayerId 关注的教练id}
//  * @return
//  * */
// export function addFocusPlayer (data) {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/addFocus`,
//     method: 'post',
//     data
//   })
// }

// /**
//  * 取消关注教练
//  * @param data {focePlayerId 关注的教练id}
//  * @return
//  * */
// export function cancelFocusPlayer (params) {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/cancelFocus`,
//     method: 'get',
//     params
//   })
// }

// /**
//  * 查看教练贡献排行榜
//  * @return
//  * */
// export function getContributeRankingData () {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/contributeRanking`,
//     method: 'get',
//   })
// }

// /**
//  * 查询达人的所有评论
//  * @param params {serverPlayerId: 达人id Y, pageNum: 第几页 N, pageSize: 每页多少条 N}
//  * @return
//  * */
// export function getPlayerAllCommentData (params) {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/allComment`,
//     method: 'get',
//     params
//   })
// }

// /**
//  * 查询所有礼物
//  * @return
//  * */
// export function getAllGiftData () {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/queryAllGift`,
//     method: 'post',
//   })
// }

// /**
//  * 赠送礼物扣减积分
//  * @return
//  * */
// export function giveGiftPointsDeducted (data) {
//   return fetch({
//     url: `${BASE_CLIENT}/serverPlayer/giveGift`,
//     method: 'post',
//     data
//   })
// }

